<?php

use Illuminate\Http\Request;
use Illuminate\Support\Facades\Route;

/*
|--------------------------------------------------------------------------
| API Routes
|--------------------------------------------------------------------------
|
| Here is where you can register API routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| is assigned the "api" middleware group. Enjoy building your API!
|
*/

Route::middleware('auth:api')->get('/user', function (Request $request) {
    return $request->user();
});


//后台路由
Route::group(['prefix'=>'admin'],function(){
    //添加权限
    Route::post('AddPermission',[\App\Http\Controllers\Admin\PermissionController::class,'AddPermission'])->middleware('LoginToken');
    //获取路由
    Route::get('GetPermission',[\App\Http\Controllers\Admin\PermissionController::class,'GetPermission'])->middleware('LoginToken');
    //删除路由
    Route::get('DelPermission',[\App\Http\Controllers\Admin\PermissionController::class,'DelPermission'])->middleware('LoginToken');
    //切换展示状态
    Route::get('CheckPermissionShow',[\App\Http\Controllers\Admin\PermissionController::class,'CheckPermissionShow'])->middleware('LoginToken');
    //切换有效状态
    Route::get('CheckPermissionStatus',[\App\Http\Controllers\Admin\PermissionController::class,'CheckPermissionStatus'])->middleware('LoginToken');
    //更新权限
    Route::post('UpdatePermission',[\App\Http\Controllers\Admin\PermissionController::class,'UpdatePermission'])->middleware('LoginToken');
    //查询所有路由
    Route::get('getPermissionOption',[\App\Http\Controllers\Admin\PermissionController::class,'getPermissionOption'])->middleware('LoginToken');
    //获取树状权限
    Route::get('GetPermissionTree',[\App\Http\Controllers\Admin\PermissionController::class,'GetPermissionTree'])->middleware('LoginToken');

    //角色
    Route::post('addRole',[\App\Http\Controllers\Admin\RoleController::class,'addRole'])->middleware('LoginToken');
    Route::get('GetRoleList',[\App\Http\Controllers\Admin\RoleController::class,'GetRoleList'])->middleware('LoginToken');
    Route::get('CheckRoleStatus',[\App\Http\Controllers\Admin\RoleController::class,'CheckRoleStatus'])->middleware('LoginToken');
    Route::get('GetRoleOption',[\App\Http\Controllers\Admin\RoleController::class,'GetRoleOption'])->middleware('LoginToken');
    Route::get('GetCheckedTree',[\App\Http\Controllers\Admin\RoleController::class,'GetCheckedTree'])->middleware('LoginToken');
    Route::post('updateRole',[\App\Http\Controllers\Admin\RoleController::class,'updateRole'])->middleware('LoginToken');
    Route::get('DelRole',[\App\Http\Controllers\Admin\RoleController::class,'DelRole'])->middleware('LoginToken');
    Route::get('GetRoleAll',[\App\Http\Controllers\Admin\RoleController::class,'GetRoleAll'])->middleware('LoginToken');

    //账号
    Route::get('getUserList',[\App\Http\Controllers\Admin\UserController::class,'getUserList'])->middleware('LoginToken');
    Route::post('addUser',[\App\Http\Controllers\Admin\UserController::class,'addUser'])->middleware('LoginToken');
    Route::post('updateUser',[\App\Http\Controllers\Admin\UserController::class,'updateUser'])->middleware('LoginToken');
    Route::get('deleteUser',[\App\Http\Controllers\Admin\UserController::class,'deleteUser'])->middleware('LoginToken');
    Route::get('CheckUserStatus',[\App\Http\Controllers\Admin\UserController::class,'CheckUserStatus'])->middleware('LoginToken');

    //登陆
    Route::post('Login',[\App\Http\Controllers\Admin\LoginController::class,'Login']);
    Route::post('getUserInfo',[\App\Http\Controllers\Admin\LoginController::class,'getUserInfo']);
    Route::get('GetPermissionInfo',[\App\Http\Controllers\Admin\LoginController::class,'GetPermissionInfo']);
    Route::post('LoginOut',[\App\Http\Controllers\Admin\LoginController::class,'LoginOut']);



    //配置表
    Route::post('SetConf',[\App\Http\Controllers\Admin\ConfigController::class,'SetConf'])->middleware('LoginToken');
    Route::get('GetConf',[\App\Http\Controllers\Admin\ConfigController::class,'GetConf'])->middleware('LoginToken');

    //上传
    Route::post('upload',[\App\Http\Controllers\Admin\UploadController::class,'upload'])->middleware('LoginToken');
});
